package com.edu.compile.dto.choice;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.edu.compile.dto.RequestParam;

import java.util.List;

public class ChoiceParam extends RequestParam<ChoiceParam> {

    private List<ChoiceConditionParam> conditions;


    @Override
    public ChoiceParam parse(String requestParam) {

        JSONObject jsonObject = JSON.parseObject(requestParam);
        this.conditions = JSON.parseObject(jsonObject.getString("conditions"), new TypeReference<List<ChoiceConditionParam>>() {
        }.getType());
        return this;
    }

    public ChoiceParam() {
    }


    public List<ChoiceConditionParam> getConditions() {
        return conditions;
    }

    public void setConditions(List<ChoiceConditionParam> conditions) {
        this.conditions = conditions;
    }
}
